/*
 *  POJ1503: Integer Inquiry
 */

/*-------- Includes --------*/
#include <cstring>
#include <iostream>

using namespace std;

/*-------- Defines --------*/
#define MAX_SIZE 128

/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    char num[MAX_SIZE];
    int  sum[MAX_SIZE] = {0};

    while (cin >> num && strcmp(num, "0")) {
        int len = strlen(num);

        for (int i = 0, j = len - 1; j >= 0; i++, j--) {
            sum[i] += num[j] - 0x30;

            if (sum[i] > 9) {
                sum[i]   %= 10;
                sum[i+1] += 1;
            }
        }
    }

    int i = MAX_SIZE;
    while (i > 0 && sum[--i] == 0);

    for (; i >= 0; i--) cout << sum[i];

    cout << endl;

    return 0;
}
